require File.expand_path('../../config/environment',  __FILE__)

f = File.new(File.expand_path('../../data/area.txt',  __FILE__))
areas = []
f.each_line do |line|
  line = line
  if line =~ /break/
    area_one = Area.new(:name => areas.shift, :level => 1) 
    areas.each{|c| area_one.cities.build({:name => c, :level => 2})}
    area_one.save!
    areas = []
  else
    mat = line.scan(/"(.+?)"/)
    unless mat.empty?
      areas << (mat.size > 1 ? mat.last.first : mat.first.first )
    end
  end
end
